Open
Conversation
nickcom007
reviewed
Mar 20, 2026
| role in ["user", "assistant", "function_call"] | ||
| and content | ||
| ): | ||
| if not content: |
Contributor
There was a problem hiding this comment.
1. Reference extraction can be misaligned with the actual prompt
You extract the reference using:
last_msg = conversations[-1]but you truncate the processed messages with:
conversation_to_process = conversation_to_process[:-1]Problem:
conversations= raw inputconversation_to_process= filtered + transformed version
If any messages were:
- skipped (empty content),
- transformed (e.g.
function_call→assistant), - or failed parsing,
then the “last raw message” may not match the “last processed message”.
You may remove one message from the prompt, but use a different one as the reference.
2. function_call reference is raw JSON string (may not match your evaluation goal)
When the last message is a function_call, you do:
reference_response = last_msg["content"]This gives you something like:
{"name":"get_weather","arguments":{"city":"Toronto"}}So your reference is:
- a raw JSON string, not
- a structured tool call, nor
- a natural language answer
This is only correct if your evaluation expects:
- exact string match of the function call JSON
Otherwise it may be inconsistent with:
- how your template represents tool calls (
tool_callsstructure) - or how your model outputs them
3. Tool call ↔ observation matching is simplified (not robust)
You assign each observation to the most recent tool call:
for prev_msg in reversed(conversation_to_process):
if prev_msg.get("role") == "assistant" and prev_msg.get("tool_calls"):
tool_call_id = prev_msg["tool_calls"][0]["id"]
breakThis assumes:
- one tool call at a time
- one observation per call
- strictly sequential flow
Works fine for simple ReAct-style traces like:
assistant → tool_call
tool → observation
assistant → next step
But breaks or becomes ambiguous if:
- multiple tool calls in one assistant message
- multiple observations
- parallel or interleaved calls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.